<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HUAWEI Mate 60 Pro - 产品详情 | HUAWEI Global Store</title>
  <style>
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
      background: #f8fafc;
      color: #1f2937;
      overflow-x: hidden;
      line-height: 1.6;
    }
    .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

    /* 禁用按钮样式 */
    .disabled-btn {
      background-color: #ccc !important;
      color: #666 !important;
      cursor: not-allowed !important;
      border-color: #d1d5db !important;
      pointer-events: none; /* 禁止点击事件 */
    }

    /* Header */
    .header {
      background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
      color: white;
      padding: 15px 0;
      position: sticky; top: 0; z-index: 1000;
      box-shadow: 0 4px 20px rgba(0,0,0,0.1);
      backdrop-filter: blur(10px);
    }
    .header-content {
      display: flex; justify-content: space-between; align-items: center;
    }
    .logo { 
      font-size: 26px; font-weight: bold; cursor: pointer; 
      display: flex; align-items: center; gap: 8px; 
      transition: transform 0.3s ease;
    }
    .logo:hover { transform: scale(1.05); }
    .nav { display: flex; gap: 25px; }
    .nav a {
      color: white; text-decoration: none; font-weight: 500;
      padding: 8px 15px; border-radius: 8px; transition: all 0.3s ease;
      position: relative;
    }
    .nav a:hover { 
      background: rgba(255,255,255,0.2); 
      transform: translateY(-2px);
    }
    .user-actions { display: flex; gap: 15px; align-items: center; }
    .btn { 
      padding: 12px 28px; border-radius: 10px; font-weight: 600; 
      cursor: pointer; transition: all 0.3s ease; border: none; 
      text-decoration: none; display: inline-block; text-align: center;
    }
    .btn-primary { 
      background: linear-gradient(135deg,#3b82f6,#1d4ed8); 
      color: white; 
      box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    }
    .btn-primary:hover { 
      background: linear-gradient(135deg,#1d4ed8,#1e40af); 
      transform: translateY(-2px); 
      box-shadow: 0 8px 25px rgba(59,130,246,.4); 
    }
    .btn-outline { 
      border: 2px solid #fff; color: #fff; background: transparent; 
      padding: 8px 16px;
    }
    .btn-outline:hover { background: #fff; color: #1d4ed8; }
    .cart-icon { 
      position: relative; cursor: pointer; font-size: 24px; 
      padding: 8px; border-radius: 50%; transition: all 0.3s ease;
    }
    .cart-icon:hover { 
      background: rgba(255,255,255,0.2); 
      transform: scale(1.1);
    }
    .cart-count {
      position: absolute; top: -5px; right: -5px;
      background: #ef4444; color: white; font-size: 12px;
      padding: 2px 6px; border-radius: 50%;
      min-width: 18px; text-align: center;
    }

    /* Hero Section */
    .hero {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white; text-align: center; padding: 80px 20px;
      position: relative; overflow: hidden;
    }
    .hero::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="1" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="1" fill="white" opacity="0.1"/><circle cx="90" cy="30" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
      animation: float 20s ease-in-out infinite;
    }
    @keyframes float {
      0%, 100% { transform: translateY(0px); }
      50% { transform: translateY(-20px); }
    }
    .hero h1 { 
      font-size: 48px; margin-bottom: 15px; font-weight: 700;
      animation: slideInUp 1s ease-out;
    }
    .hero p { 
      font-size: 20px; opacity: .9; 
      animation: slideInUp 1s ease-out 0.2s both;
    }
    @keyframes slideInUp {
      from { opacity: 0; transform: translateY(30px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Breadcrumb */
    .breadcrumb {
      background: #fff;
      padding: 15px 0;
      border-bottom: 1px solid #e5e7eb;
    }
    .breadcrumb-nav {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 14px;
    }
    .breadcrumb-nav a {
      color: #6b7280;
      text-decoration: none;
      transition: color 0.3s ease;
    }
    .breadcrumb-nav a:hover {
      color: #3b82f6;
    }
    .breadcrumb-separator {
      color: #9ca3af;
    }

    /* Product Detail */
    .product-showcase { 
      padding: 70px 0; 
      background: #fff; 
    }
    .product-detail-grid {
      display: grid; 
      grid-template-columns: 1fr 1fr; 
      gap: 60px; 
      align-items: start;
    }
    .product-image {
      position: relative;
    }
    .product-image img {
      width: 100%; 
      border-radius: 20px; 
      box-shadow: 0 20px 50px rgba(0,0,0,.15);
      transition: transform 0.3s ease;
    }
    .product-image:hover img {
      transform: scale(1.02);
    }
    .product-info h2 { 
      font-size: 36px; 
      color: #3b82f6; 
      margin-bottom: 20px; 
      font-weight: 700;
    }
    .product-info .price {
      font-size: 32px;
      color: #ef4444;
      font-weight: 700;
      margin-bottom: 20px;
    }
    .product-info .original-price {
      font-size: 18px;
      color: #9ca3af;
      text-decoration: line-through;
      margin-left: 10px;
    }
    .product-info p { 
      margin-bottom: 25px; 
      color: #4b5563; 
      font-size: 16px;
      line-height: 1.7;
    }
    
    /* Features Grid */
    .features-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 20px;
      margin: 30px 0;
    }
    .feature-item {
      background: #f8fafc;
      padding: 20px;
      border-radius: 12px;
      border-left: 4px solid #3b82f6;
      transition: all 0.3s ease;
    }
    .feature-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(0,0,0,.1);
    }
    .feature-item h4 {
      color: #1f2937;
      font-weight: 600;
      margin-bottom: 5px;
    }
    .feature-item p {
      color: #6b7280;
      font-size: 14px;
      margin: 0;
    }

    /* Action Buttons */
    .action-buttons {
      display: flex;
      gap: 15px;
      margin-top: 30px;
    }
    .action-buttons .btn {
      flex: 1;
      padding: 16px;
      font-size: 16px;
      border-radius: 12px;
    }
    .btn-secondary {
      background: #f3f4f6;
      color: #374151;
      border: 2px solid #e5e7eb;
    }
    .btn-secondary:hover {
      background: #e5e7eb;
      transform: translateY(-2px);
    }

    /* Tabs */
    .product-tabs {
      background: #f9fafb;
      padding: 50px 0;
    }
    .tab-navigation {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-bottom: 40px;
    }
    .tab-btn {
      padding: 12px 24px;
      background: #fff;
      border: 2px solid #e5e7eb;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.3s ease;
      font-weight: 500;
    }
    .tab-btn.active {
      background: #3b82f6;
      color: white;
      border-color: #3b82f6;
    }
    .tab-btn:hover:not(.active) {
      border-color: #3b82f6;
      color: #3b82f6;
    }
    .tab-content {
      background: #fff;
      padding: 40px;
      border-radius: 16px;
      box-shadow: 0 4px 15px rgba(0,0,0,.05);
      display: none;
    }
    .tab-content.active {
      display: block;
      animation: fadeInUp 0.5s ease-out;
    }
    @keyframes fadeInUp {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Reservation Form */
    .reservation-section {
      background: linear-gradient(135deg, #f8fafc 0%, #e5e7eb 100%);
      padding: 70px 0;
    }
    .section-title {
      text-align: center;
      font-size: 32px;
      color: #1f2937;
      margin-bottom: 15px;
      font-weight: 700;
    }
    .section-subtitle {
      text-align: center;
      color: #6b7280;
      margin-bottom: 40px;
      font-size: 18px;
    }
    .reservation-form {
      max-width: 700px; 
      margin: 0 auto;
      background: #fff; 
      padding: 40px;
      border-radius: 20px;
      box-shadow: 0 20px 50px rgba(0,0,0,.1);
      transition: all .3s;
    }
    .form-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      margin-bottom: 20px;
    }
    .form-group {
      margin-bottom: 20px;
    }
    .form-group label {
      display: block;
      margin-bottom: 8px;
      font-weight: 600;
      color: #374151;
    }
    .form-group .required {
      color: #ef4444;
    }
    .reservation-form input,
    .reservation-form select,
    .reservation-form textarea {
      width: 100%; 
      padding: 15px; 
      border: 2px solid #e5e7eb; 
      border-radius: 12px; 
      font-size: 15px;
      transition: all .3s ease;
      background: #fafafa;
    }
    .reservation-form input:focus,
    .reservation-form select:focus,
    .reservation-form textarea:focus {
      border-color: #3b82f6; 
      box-shadow: 0 0 0 3px rgba(59,130,246,.1);
      outline: none;
      background: #fff;
    }
    .reservation-form button {
      width: 100%; 
      padding: 18px; 
      border: none;
      background: linear-gradient(135deg,#3b82f6,#1d4ed8);
      color: white; 
      border-radius: 12px; 
      font-size: 16px;
      font-weight: 600;
      transition: all .3s;
      cursor: pointer;
    }
    .reservation-form button:hover { 
      background: linear-gradient(135deg,#1d4ed8,#1e40af); 
      transform: translateY(-2px); 
      box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
    }

    /* Success Popup */
    .popup-overlay {
      position: fixed; top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.6);
      display: none; align-items: center; justify-content: center;
      z-index: 2000;
      backdrop-filter: blur(5px);
    }
    .popup {
      background: #fff; 
      padding: 40px;
      border-radius: 20px; 
      text-align: center;
      box-shadow: 0 20px 50px rgba(0,0,0,.3);
      max-width: 450px; 
      width: 90%;
      animation: popupSlideIn .4s ease-out;
    }
    .popup .success-icon {
      font-size: 48px;
      margin-bottom: 20px;
      animation: bounce 0.6s ease-out;
    }
    @keyframes bounce {
      0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
      40% { transform: translateY(-10px); }
      60% { transform: translateY(-5px); }
    }
    .popup h3 { 
      margin-bottom: 15px; 
      color: #1d4ed8; 
      font-size: 24px;
      font-weight: 700;
    }
    .popup p { 
      color: #4b5563; 
      margin-bottom: 25px; 
      line-height: 1.6;
    }
    .popup button {
      background: linear-gradient(135deg,#3b82f6,#1d4ed8);
      color: white; 
      border: none; 
      padding: 12px 30px;
      border-radius: 10px; 
      cursor: pointer;
      transition: all .3s;
      font-weight: 600;
    }
    .popup button:hover { 
      background: linear-gradient(135deg,#1d4ed8,#1e40af); 
      transform: translateY(-2px);
    }
    @keyframes popupSlideIn { 
      from {opacity:0; transform:scale(.8) translateY(-20px);} 
      to {opacity:1; transform:scale(1) translateY(0);} 
    }

    /* Login Modal */
    .login-modal {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.6);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 3000;
      backdrop-filter: blur(5px);
    }
    .login-form {
      background: white;
      padding: 40px;
      border-radius: 20px;
      box-shadow: 0 20px 50px rgba(0,0,0,0.3);
      max-width: 400px;
      width: 90%;
      animation: slideInUp 0.4s ease-out;
    }
    .login-form h2 {
      text-align: center;
      margin-bottom: 30px;
      color: #1f2937;
    }

    /* Responsive Design */
    @media (max-width: 768px) {
      .product-detail-grid { 
        grid-template-columns: 1fr; 
        gap: 40px;
        text-align: center; 
      }
      .hero h1 { font-size: 32px; }
      .hero p { font-size: 16px; }
      .form-row { 
        grid-template-columns: 1fr; 
        gap: 0; 
      }
      .features-grid {
        grid-template-columns: 1fr;
      }
      .action-buttons {
        flex-direction: column;
      }
      .tab-navigation {
        flex-wrap: wrap;
      }
      .nav {
        display: none;
      }
      .user-actions select {
        display: none;
      }
    }

    @media (max-width: 480px) {
      .container {
        padding: 0 15px;
      }
      .hero {
        padding: 50px 15px;
      }
      .product-showcase,
      .product-tabs,
      .reservation-section {
        padding: 40px 0;
      }
      .reservation-form {
        padding: 25px;
      }
    }
  </style>
</head>
<body>
  <!-- Header -->
  <header class="header">
    <div class="container">
      <div class="header-content">
        <div class="logo" onclick="window.location.href='index.html'">
          🏪 HUAWEI Global Store
        </div>
        <nav class="nav">
          <a href="index.html">首页</a>
          <a href="product-list.html">新品</a>
          <a href="support.html">支持</a>
          <a href="about.html">关于</a>
        </nav>
        <div class="user-actions">
          <select style="padding: 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.1); color: white;">
            <option>🇨🇳 中文</option>
            <option>🇺🇸 English</option>
            <option>🇯🇵 日本語</option>
            <option>🇩🇪 Deutsch</option>
          </select>
          <div class="cart-icon" id="cartIcon" onclick="handleCartClick()">
            🛒
            <div class="cart-count" id="cartCount">0</div>
          </div>
          <button id="loginBtn" class="btn btn-outline" onclick="openLoginModal()">登录</button>
          <button id="profileBtn" class="btn btn-outline" onclick="handleProfileClick()">个人中心</button>
        </div>
      </div>
    </div>
  </header>

  <!-- Breadcrumb -->
  <section class="breadcrumb">
    <div class="container">
      <nav class="breadcrumb-nav">
        <a href="index.html">首页</a>
        <span class="breadcrumb-separator">></span>
        <a href="product-list.html">手机</a>
        <span class="breadcrumb-separator">></span>
        <span style="color: #3b82f6;">HUAWEI Mate 60 Pro</span>
      </nav>
    </div>
  </section>

  <!-- Hero -->
  <section class="hero">
    <div class="container">
      <h1>HUAWEI Mate 60 Pro</h1>
      <p>开启全新智能体验 • 卫星通信 • 超强影像</p>
    </div>
  </section>

  <!-- Product Detail -->
  <section class="product-showcase">
    <div class="container">
      <div class="product-detail-grid">
        <div class="product-image">
          <img src="https://images.unsplash.com/photo-1592899677977-9c10ca588bbd?w=600&h=600&fit=crop" alt="HUAWEI Mate 60 Pro">
        </div>
        <div class="product-info">
          <h2>HUAWEI Mate 60 Pro</h2>
          <div class="price">
            ￥6,999
            <span class="original-price">￥7,999</span>
          </div>
          <p>HUAWEI Mate 60 Pro 配备强大的麒麟9000S处理器，支持卫星通信技术，拥有超感知影像系统和6.82英寸超清曲面屏，为您带来前所未有的智能体验。</p>
          
          <div class="features-grid">
            <div class="feature-item">
              <h4>🛰️ 卫星通信</h4>
              <p>全球首款支持卫星通话的智能手机</p>
            </div>
            <div class="feature-item">
              <h4>📱 超清屏幕</h4>
              <p>6.82英寸OLED曲面屏，120Hz刷新率</p>
            </div>
            <div class="feature-item">
              <h4>📷 影像系统</h4>
              <p>5000万像素超感知主摄，支持10倍光学变焦</p>
            </div>
            <div class="feature-item">
              <h4>🔋 长续航</h4>
              <p>5000mAh大电池，88W快充技术</p>
            </div>
          </div>

          <div class="action-buttons">
            <button class="btn btn-primary" onclick="scrollToReservation()">立即预约</button>
            <button class="btn btn-secondary" onclick="addToCart()">加入购物车</button>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- Product Tabs -->
  <section class="product-tabs">
    <div class="container">
      <div class="tab-navigation">
        <button class="tab-btn active" onclick="switchTab('specs')">技术规格</button>
        <button class="tab-btn" onclick="switchTab('features')">主要特性</button>
        <button class="tab-btn" onclick="switchTab('reviews')">用户评价</button>
        <button class="tab-btn" onclick="switchTab('support')">售后服务</button>
      </div>

      <div id="specs" class="tab-content active">
        <h3 style="margin-bottom: 20px; color: #1f2937;">技术规格</h3>
        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px;">
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">处理器</h4>
            <p>麒麟9000S 5G芯片</p>
          </div>
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">内存</h4>
            <p>12GB RAM + 256GB/512GB/1TB ROM</p>
          </div>
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">屏幕</h4>
            <p>6.82英寸OLED曲面屏，2720×1260分辨率</p>
          </div>
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">相机</h4>
            <p>后置：5000万主摄+1200万超广角+6400万潜望式长焦</p>
          </div>
        </div>
      </div>

      <div id="features" class="tab-content">
        <h3 style="margin-bottom: 20px; color: #1f2937;">主要特性</h3>
        <ul style="list-style: none; padding: 0;">
          <li style="margin-bottom: 15px; padding-left: 30px; position: relative;">
            <span style="position: absolute; left: 0; color: #3b82f6;">🔹</span>
            全球首款支持卫星通话功能的智能手机
          </li>
          <li style="margin-bottom: 15px; padding-left: 30px; position: relative;">
            <span style="position: absolute; left: 0; color: #3b82f6;">🔹</span>
            超感知影像系统，支持10倍光学变焦
          </li>
          <li style="margin-bottom: 15px; padding-left: 30px; position: relative;">
            <span style="position: absolute; left: 0; color: #3b82f6;">🔹</span>
            鸿蒙HarmonyOS 4.0操作系统
          </li>
          <li style="margin-bottom: 15px; padding-left: 30px; position: relative;">
            <span style="position: absolute; left: 0; color: #3b82f6;">🔹</span>
            IP68级防水防尘设计
          </li>
        </ul>
      </div>

      <div id="reviews" class="tab-content">
        <h3 style="margin-bottom: 20px; color: #1f2937;">用户评价</h3>
        <div style="display: grid; gap: 20px;">
          <div style="background: #f8fafc; padding: 20px; border-radius: 12px; border-left: 4px solid #3b82f6;">
            <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;">
              <strong>张先生</strong>
              <div style="color: #fbbf24;">⭐⭐⭐⭐⭐</div>
            </div>
            <p style="color: #4b5563;">"卫星通信功能真的很实用，在偏远地区也能保持通讯。相机效果也非常出色！"</p>
          </div>
          <div style="background: #f8fafc; padding: 20px; border-radius: 12px; border-left: 4px solid #3b82f6;">
            <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;">
              <strong>李女士</strong>
              <div style="color: #fbbf24;">⭐⭐⭐⭐⭐</div>
            </div>
            <p style="color: #4b5563;">"屏幕显示效果很棒，系统运行流畅，电池续航能力强。非常满意的一次购买！"</p>
          </div>
        </div>
      </div>

      <div id="support" class="tab-content">
        <h3 style="margin-bottom: 20px; color: #1f2937;">售后服务</h3>
        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px;">
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">保修政策</h4>
            <p>整机保修12个月，主要配件保修24个月</p>
          </div>
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">退换货</h4>
            <p>7天无理由退货，15天换货服务</p>
          </div>
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">客服支持</h4>
            <p>24小时在线客服，全国服务网点支持</p>
          </div>
          <div>
            <h4 style="color: #3b82f6; margin-bottom: 10px;">免费服务</h4>
            <p>免费贴膜，免费数据迁移服务</p>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- Reservation -->
  <section id="reservation" class="reservation-section">
    <div class="container">
      <h2 class="section-title">预约购买</h2>
      <p class="section-subtitle">请填写以下信息，我们将为您保留最新款 HUAWEI Mate 60 Pro</p>
      <form class="reservation-form" id="reservationForm">
        <div class="form-row">
          <div class="form-group">
            <label>姓名 <span class="required">*</span></label>
            <input type="text" name="name" placeholder="请输入您的姓名" required>
          </div>
          <div class="form-group">
            <label>性别</label>
            <select name="gender">
              <option value="">请选择性别</option>
              <option value="male">男</option>
              <option value="female">女</option>
              <option value="other">其他</option>
            </select>
          </div>
        </div>

        <div class="form-row">
          <div class="form-group">
            <label>联系电话 <span class="required">*</span></label>
            <input type="tel" name="phone" placeholder="请输入手机号码" required>
          </div>
          <div class="form-group">
            <label>邮箱地址</label>
            <input type="email" name="email" placeholder="请输入邮箱地址">
          </div>
        </div>

        <div class="form-row">
          <div class="form-group">
            <label>预约日期 <span class="required">*</span></label>
            <input type="date" name="date" required>
          </div>
          <div class="form-group">
            <label>预约时间 <span class="required">*</span></label>
            <input type="time" name="time" required>
          </div>
        </div>

        <div class="form-row">
          <div class="form-group">
            <label>产品配置 <span class="required">*</span></label>
            <select name="product" required>
              <option value="">请选择产品配置</option>
              <option value="256gb">Mate 60 Pro - 12+256GB - ￥6,999</option>
              <option value="512gb">Mate 60 Pro - 12+512GB - ￥7,699</option>
              <option value="1tb">Mate 60 Pro - 12+1TB - ￥8,999</option>
            </select>
          </div>
          <div class="form-group">
            <label>颜色偏好</label>
            <select name="color">
              <option value="">请选择颜色</option>
              <option value="black">雅黑色</option>
              <option value="white">羽砂白</option>
              <option value="green">雅川青</option>
              <option value="purple">南糯紫</option>
            </select>
          </div>
        </div>

        <div class="form-group">
          <label>预约人数</label>
          <input type="number" name="people" placeholder="预约人数" min="1" max="5" value="1">
        </div>

        <div class="form-group">
          <label>备注信息</label>
          <textarea name="notes" rows="4" placeholder="请输入特殊需求或备注信息（如配件需求、取货时间偏好等）"></textarea>
        </div>

        <div style="margin-bottom: 20px; padding: 15px; background: #f0f9ff; border-radius: 8px; border-left: 4px solid #3b82f6;">
          <p style="margin: 0; color: #1e40af; font-size: 14px;">
            <strong>温馨提示：</strong>预约成功后，我们将在24小时内联系您确认预约详情。产品将为您保留3个工作日。
          </p>
        </div>

        <button type="submit">提交预约</button>
      </form>
    </div>
  </section>

  <!-- Success Popup -->
  <div class="popup-overlay" id="popupOverlay">
    <div class="popup">
      <div class="success-icon">✅</div>
      <h3>预约提交成功！</h3>
      <p>感谢您选择华为！我们已收到您的预约信息，客服将在24小时内联系您确认预约详情。</p>
      <button onclick="closePopup()">我知道了</button>
    </div>
  </div>

  <!-- Login Modal -->
  <div class="login-modal" id="loginModal">
    <div class="login-form">
      <h2>用户登录</h2>
      <div class="form-group">
        <label>用户名</label>
        <input type="text" id="loginUsername" placeholder="请输入用户名">
      </div>
      <div class="form-group">
        <label>密码</label>
        <input type="password" id="loginPassword" placeholder="请输入密码">
      </div>
      <div style="display: flex; gap: 10px; margin-top: 20px;">
        <button class="btn btn-primary" onclick="performLogin()" style="flex: 1;">登录</button>
        <button class="btn btn-secondary" onclick="closeLoginModal()" style="flex: 1;">取消</button>
      </div>
      <p style="text-align: center; margin-top: 15px; color: #6b7280; font-size: 14px;">
        演示账号：demo / 123456
      </p>
    </div>
  </div>

  <script>
    // ==========================
    // 全局变量
    // ==========================
    let currentUser = null;

    // 获取DOM元素
    const $loginBtn = document.getElementById('loginBtn');
    const $profileBtn = document.getElementById('profileBtn');

    // ==========================
    // 页面加载初始化
    // ==========================
    window.addEventListener('load', function() {
      initializePage();
      setMinDate();
      loadCartCount();
    });

    function initializePage() {
      updateLoginState();
      autoClearCache();
    }

    function setMinDate() {
      const dateInput = document.querySelector('input[name="date"]');
      if (dateInput) {
        const today = new Date();
        const tomorrow = new Date(today);
        tomorrow.setDate(today.getDate() + 1);
        dateInput.min = tomorrow.toISOString().split('T')[0];
      }
    }

    function loadCartCount() {
      const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
      let cartItems = 0;
      if (isLoggedIn) {
        cartItems = parseInt(localStorage.getItem('cartItems')) || 0;
      }
      const cartCountElement = document.getElementById('cartCount');
      if (cartCountElement) {
        cartCountElement.textContent = cartItems;
      }
    }

    // ==========================
    // 自动清缓存（24小时）
    // ==========================
    function autoClearCache() {
      const now = Date.now();
      const cacheExpire = 24 * 60 * 60 * 1000; // 24小时
      const lastClear = parseInt(localStorage.getItem('lastClear')) || 0;

      if (now - lastClear > cacheExpire) {
        console.log('🧹 自动清缓存：超过24小时，清理本地存储数据');
        localStorage.removeItem('cartItems');
        localStorage.removeItem('isLoggedIn');
        localStorage.setItem('lastClear', now);
        updateLoginState();
        loadCartCount();
      }
    }

    // ==========================
    // 登录/退出逻辑
    // ==========================
    function updateLoginState() {
      const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
      
      if (isLoggedIn) {
        // 已登录状态：
        // 1. 登录按钮不可用且为灰色，显示"已登录"
        $loginBtn.disabled = true;
        $loginBtn.classList.add('disabled-btn');
        $loginBtn.textContent = '已登录';
        
        // 2. 个人中心按钮可用
        $profileBtn.disabled = false;
        $profileBtn.classList.remove('disabled-btn');
        
        currentUser = localStorage.getItem('currentUser') || 'demo';
      } else {
        // 未登录状态：
        // 1. 登录按钮可用
        $loginBtn.disabled = false;
        $loginBtn.classList.remove('disabled-btn');
        $loginBtn.textContent = '登录';
        
        // 2. 个人中心按钮不可用且为灰色
        $profileBtn.disabled = true;
        $profileBtn.classList.add('disabled-btn');
        
        currentUser = null;
        // 未登录时清空购物车
        localStorage.removeItem('cartItems');
        loadCartCount();
      }
    }

    function openLoginModal() {
      document.getElementById('loginModal').style.display = 'flex';
    }

    function closeLoginModal() {
      document.getElementById('loginModal').style.display = 'none';
    }

    function logout() {
      localStorage.removeItem('isLoggedIn');
      localStorage.removeItem('currentUser');
      localStorage.removeItem('cartItems');
      currentUser = null;
      updateLoginState();
      showNotification('已退出登录', 'info');
    }

    // 模拟登录功能
    function performLogin() {
      const username = document.getElementById('loginUsername').value;
      const password = document.getElementById('loginPassword').value;
      
      // 简单验证（实际应用中应该与服务器交互）
      if (username && password) {
        localStorage.setItem('isLoggedIn', 'true');
        localStorage.setItem('currentUser', username);
        updateLoginState();
        closeLoginModal();
        showNotification('登录成功', 'success');
      } else {
        showNotification('请输入用户名和密码', 'warning');
      }
    }

    // ==========================
    // 购物车功能
    // ==========================
    function handleCartClick() {
      const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
      if (!isLoggedIn) {
        // 未登录时跳转到登录页面
        showNotification('请先登录才能使用购物车', 'warning');
        window.location.href = 'login.html';
        return;
      }
      // 已登录时跳转到购物车页面
      window.location.href = 'cart.html';
    }

    function addToCart() {
      const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
      if (!isLoggedIn) {
        showNotification('请先登录才能加入购物车', 'warning');
        window.location.href = 'login.html';
        return;
      }
      
      let cartItems = parseInt(localStorage.getItem('cartItems')) || 0;
      cartItems += 1;
      localStorage.setItem('cartItems', cartItems);
      loadCartCount();
      showNotification('商品已加入购物车！', 'success');
    }

    // ==========================
    // 个人中心
    // ==========================
    function handleProfileClick() {
      const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
      if (!isLoggedIn) {
        showNotification('请先登录才能进入个人中心', 'warning');
        window.location.href = 'login.html';
        return;
      }
      // 跳转到个人中心页面
      window.location.href = 'user-center.html';
    }

    // ==========================
    // 标签页切换
    // ==========================
    function switchTab(tabName) {
      // 移除所有active类
      document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
      document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
      
      // 添加active类到当前选中的标签
      event.target.classList.add('active');
      document.getElementById(tabName).classList.add('active');
    }

    // ==========================
    // 页面滚动
    // ==========================
    function scrollToReservation() {
      document.getElementById('reservation').scrollIntoView({ 
        behavior: 'smooth',
        block: 'start'
      });
    }

    // ==========================
    // 预约表单处理
    // ==========================
    const form = document.getElementById('reservationForm');
    const popupOverlay = document.getElementById('popupOverlay');

    form.addEventListener('submit', function(e) {
      e.preventDefault();
      
      // 验证表单
      if (!validateReservationForm()) {
        return;
      }
      
      // 显示成功弹窗
      popupOverlay.style.display = 'flex';
      
      // 3秒后自动关闭
      setTimeout(() => {
        closePopup();
      }, 5000);
      
      // 重置表单
      form.reset();
      
      // 重新设置日期最小值
      setMinDate();
    });

    function validateReservationForm() {
      const requiredFields = form.querySelectorAll('[required]');
      for (let field of requiredFields) {
        if (!field.value.trim()) {
          field.focus();
          showNotification(`请填写 ${field.previousElementSibling.textContent}`, 'warning');
          return false;
        }
      }
      
      // 验证手机号格式
      const phone = form.querySelector('input[name="phone"]').value;
      const phoneRegex = /^1[3-9]\d{9}$/;
      if (!phoneRegex.test(phone)) {
        showNotification('请输入正确的手机号码格式', 'warning');
        return false;
      }
      
      // 验证邮箱格式
      const email = form.querySelector('input[name="email"]').value;
      if (email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
        showNotification('请输入正确的邮箱格式', 'warning');
        return false;
      }
      
      return true;
    }

    function closePopup() {
      popupOverlay.style.display = 'none';
    }

    // ==========================
    // 通知系统
    // ==========================
    function showNotification(message, type = 'info') {
      // 创建通知元素
      const notification = document.createElement('div');
      notification.style.cssText = `
        position: fixed;
        top: 20px;
        right: 20px;
        padding: 15px 20px;
        border-radius: 8px;
        color: white;
        font-weight: 500;
        z-index: 5000;
        max-width: 300px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        animation: slideInRight 0.3s ease-out;
      `;
      
      // 根据类型设置背景色
      switch(type) {
        case 'success':
          notification.style.background = 'linear-gradient(135deg, #10b981, #059669)';
          break;
        case 'warning':
          notification.style.background = 'linear-gradient(135deg, #f59e0b, #d97706)';
          break;
        case 'error':
          notification.style.background = 'linear-gradient(135deg, #ef4444, #dc2626)';
          break;
        default:
          notification.style.background = 'linear-gradient(135deg, #3b82f6, #1d4ed8)';
      }
      
      notification.textContent = message;
      document.body.appendChild(notification);
      
      // 3秒后移除
      setTimeout(() => {
        notification.style.animation = 'slideOutRight 0.3s ease-out';
        setTimeout(() => {
          document.body.removeChild(notification);
        }, 300);
      }, 3000);
    }

    // 添加CSS动画
    const style = document.createElement('style');
    style.textContent = `
      @keyframes slideInRight {
        from { transform: translateX(100%); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
      }
      @keyframes slideOutRight {
        from { transform: translateX(0); opacity: 1; }
        to { transform: translateX(100%); opacity: 0; }
      }
    `;
    document.head.appendChild(style);

    // ==========================
    // 键盘事件处理
    // ==========================
    document.addEventListener('keydown', function(e) {
      // ESC关闭弹窗
      if (e.key === 'Escape') {
        if (popupOverlay.style.display === 'flex') {
          closePopup();
        }
        if (document.getElementById('loginModal').style.display === 'flex') {
          closeLoginModal();
        }
      }
    });

    // ==========================
    // 页面性能优化
    // ==========================
    // 图片懒加载
    if ('IntersectionObserver' in window) {
      const imageObserver = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
          if (entry.isIntersecting) {
            const img = entry.target;
            if (img.dataset.src) {
              img.src = img.dataset.src;
              img.removeAttribute('data-src');
              imageObserver.unobserve(img);
            }
          }
        });
      });

      document.querySelectorAll('img[data-src]').forEach(img => {
        imageObserver.observe(img);
      });
    }

    // 平滑滚动兼容性处理
    if (!('scrollBehavior' in document.documentElement.style)) {
      const scrollToElement = (element) => {
        const start = window.pageYOffset;
        const target = element.getBoundingClientRect().top + start;
        const distance = target - start;
        const duration = 500;
        let startTime = null;

        const animation = (currentTime) => {
          if (startTime === null) startTime = currentTime;
          const timeElapsed = currentTime - startTime;
          const run = ease(timeElapsed, start, distance, duration);
          window.scrollTo(0, run);
          if (timeElapsed < duration) requestAnimationFrame(animation);
        };

        const ease = (t, b, c, d) => {
          t /= d / 2;
          if (t < 1) return c / 2 * t * t + b;
          t--;
          return -c / 2 * (t * (t - 2) - 1) + b;
        };

        requestAnimationFrame(animation);
      };

      window.scrollToReservation = () => {
        scrollToElement(document.getElementById('reservation'));
      };
    }
  </script>
</body>

</html>
